/***************************************************************
 * Name:      IrReaderClient.cpp
 * Purpose:   Base of IrReader Client
 * Author:    Jimmy F.Klarke (isjfk@163.com)
 * Created:   2009-08-15
 * Copyright: Jimmy F.Klarke (http://www.isjfk.org)
 * License:
 **************************************************************/

#include "IrReaderClient.h"

IrReaderClient::IrReaderClient()
{
    for (size_t i = 0; i < sizeof(mcuConfig); i++) {
        mcuConfig[i] = 0;
    }
}

IrReaderClient::~IrReaderClient()
{
}

bool IrReaderClient::isMcuWriteSigLen()
{
    return mcuConfig[0] & MCU_WRITE_SIG_LEN;
}

void IrReaderClient::setMcuWriteSigLen(bool writeSigLen)
{
    if (writeSigLen) {
        mcuConfig[0] |= MCU_WRITE_SIG_LEN;
    } else {
        mcuConfig[0] &= ~MCU_WRITE_SIG_LEN;
    }
}


IrReaderClientException::IrReaderClientException(int code)
{
    this->code = code;
    this->msg = "unknown error";
}

IrReaderClientException::IrReaderClientException(string msg)
{
    this->code = UNKNOWN_ERROR;
    this->msg = msg;
}

IrReaderClientException::IrReaderClientException(int code, string msg)
{
    this->code = code;
    this->msg = msg;
}

int IrReaderClientException::getCode()
{
    return code;
}

string IrReaderClientException::getMsg()
{
    return msg;
}
